﻿using System.Collections.Generic;
using System.Linq;

namespace Patterns.Tools.CodeGenerators.GoogleCode
{
	public class HierarchicalScanResults
	{
		public ScanResults Result { get; set; }
		public IEnumerable<HierarchicalScanResults> Children { get; set; }
		public IEnumerable<ScanResults> Dump()
		{
			yield return Result;
			var childResults = Children.OrderBy(item => item.Result.Name).SelectMany(item => item.Dump());
			foreach (var child in childResults)
			{
				yield return child;
			}
		}
	}
}